//注册
const fs = require("fs"); //引入

let c = fs.readFileSync("persons.json").toString();
let n = JSON.parse(c);//转对象为了更好的添加数据

let user = { username:"admin1",password:"12345" }
var s = n.find((item) => user.username === item.username);
if (s) {
  console.log("您已经注册过了，可以登录！");
} else {
 n.push(user);
}
fs.writeFileSync('persons.json',JSON.stringify(n))


